<?php
/**
 * 验证码
 *
 * @author Alen
 * @since 1.0.0 2013-4-26 sutroon
 * @example <div class="captcha"><div style="float:left; margin-top:10px;">请选<span>-</span>方块</div><div class="captcha-colors" style="float:left;">&nbsp;</div><div style="float:left; margin-top:10px;"><a href="###">[换一组]</a><input type="hidden" name="captcha" /></div><div style="clear:both;"></div></div>
 */
class Api_CaptchaAction extends SoAction {
    //put your code here
    public function index(){
        $vars=array('lvse'=>'绿色','juse'=>'橘色','zise'=>'紫色','lanse'=>'蓝色','hongse'=>'红色');
	$colors=array_rand($vars,3);
	$colors=array_unique($colors);
	shuffle($colors);
	$id=$colors[array_rand($colors)];
	$_SESSION['captcha']=$id;
	$return=$vars[$id];
	foreach($colors as $c){
			$return.='<span class="yzm '.$c.'"></span>';
	}
	echo $return;        
    }
}

?>
